I want to resize an iframe with javascript according to URL,
I mean If url is:
iframe < Code> & lt; Iframe width = "800" height = "450" scrolling = "no" frameborder = "0" permission representative = "true" margin width = "0" margin-height = "0" src = "http: // mips .tv / embedplayer / Test121 / 1/800/450 "& gt; & Lt; / Iframe & gt; See that the width and height values are twice each in the iframe Here I have an example, but now it is working in the source values of iframe A regular expression will be useful for queries. Anyway, I can also use regular expressions for the desired format. I simply urge strongly to use a query string. If you want to change the frame size, then just replace To learn more about regular expressions in JavaScript, see mywebpage.com/example.html?width=800&hight=450
// Where the frame is the above iframe shown to you: var query = JSON.parse (('{' + (frame.source.substr (1) .replace (new RegExp ("( [^ =] +) = ([^ & Amp;; +] & amp; ??, 'g'), work () {return '' '+ argument [1] +' ":" '+ logic [2] ] + '",';})) + '}'). Substitution (/, \} /,"} "));
var width = - 1; Var height = -1; ... // frame that Iframe is what you show // You should consider adding that ID attribute so that you can recognize it later // This is a good coding practice Var result = frame. Match (/ ([0-9] +) \ / ([0-9] +) $ /); if (results.length == 3) {width = parseInt (result [1]); height = parseInt (result [2]);} Else {// something is wrong Gone ...}
() instead of
mail () . Make sure that you are described according to the function.
No comments:
Post a Comment