Jump to content
php.lv forumi
  • 0

js iframe


Question

Posted

Sveiki taka no js vispar neko nejedzu , prasu jusu palidzibu :)

 

Ka šim kodam pielikt width un height lai rada to iframe ?

width un height ir nepieciešams lai parbauditu scripta darbibu , jo tgd viņš itka ielade bet neko nerada .

 

<script>var rs_id=MANS ID;</script>
<script>
var vote_hd = document.getElementsByTagName('head')[0];
var vote_tag = document.createElement('iframe');
vote_tag.src = 'http://manalapa.lv?p=' + rs_id;
vote_hd.appendChild(vote_tag);
</script>

 

 

iepriekš tnq

8 answers to this question

Recommended Posts

  • 0
Posted (edited)

jo gala rezultata man vajadzes panakt ta

 

<script>var rs_id=UNIQ ID;</script>
<script src="http://manalapa.lv/krutajs.js"></script>

 

 

pieliku to width un height lkm nepreizi , tik un ta neko nerada .

 

<script>
var vote_hd = document.getElementsByTagName('head')[0];
var vote_tag = document.createElement('iframe');
vote_tag.width = '300';
vote_tag.height = '300';
vote_tag.src = 'http://manalapa.lv?p=' + rs_id;
vote_hd.appendChild(vote_tag);
</script>

Edited by FT3
  • 0
Posted

 

Pamēģināji `setAttribute()`?

 

pirmstam jav biju meginajis http://www.dyn-web.com/tutorials/iframes/

 

Izdomaju daudz vieglaku variantu ;]

<script>var rs_id='MANS ID';</script>

<script>
var rs_w='300';
var rs_h='300';
document.write('<iframe src="http://manalapa.lv?p=' +rs_id + '" width="' +rs_w + '" height="' +rs_h + '"></iframe>');
</script>

  • 0
Posted (edited)

ja ieseto ar JS tad jānorāda mērvienības

 

vote_tag.STYLE.width = '300Px';

vote_tag.STYLE.height = '300Px';

 

piedevām iepriekš jābūt norādītam CSS atribūtos style="width=100;" ( nu kautvai 0 ), ja veido no jauna, vai nav norādīts, tad tas ir jāieseto ar setAttribute()

Edited by Grey_Wolf
  • 0
Posted

Ir kāds iemesls kāpēc tu neizmanto kādu librariju?

 

Piemēram jQuery:

 

vote_tag.css({
   width: 300,
   height: 300
});

 

Vienkārši atvieglos tavu dzīvi! :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...