Jump to content

php echo in a popup


deamon1767

Recommended Posts

<h1 id="getH1"><?php echo JHTML::link($product->link, $product->product_name); ?></h1>

 

var text = document.getElementById("getH1").innerHTML;

alert(text);

 

see if that works? If your running script from html head remember to call it from inside window.onload anonymous function else top is fine im sure  :shy:

etc

 

window.onload = function(){

var text = document.getElementById("getH1").innerHTML;

alert(text);

}

 

Oh bugger sorry bout double post quote not modify :(

Link to comment
https://forums.phpfreaks.com/topic/255448-php-echo-in-a-popup/#findComment-1309716
Share on other sites

I put

 

<h1 id="getH1"><?php echo JHTML::link($product->link, $product->product_name); ?></h1>

 

var text = document.getElementById("getH1").innerHTML;

alert(text);

 

but just printed var text = document.getElementById("getH1").innerHTML;

alert(text);

 

NO popup

Am I missing something?

Link to comment
https://forums.phpfreaks.com/topic/255448-php-echo-in-a-popup/#findComment-1309897
Share on other sites

  • 2 weeks later...

Still not working

 

Heres my code:  This code is inside a php page

 

<script type="text/javascript">

var text = document.getElementById("getH1").innerHTML;

alert(text);

</script>

 

  <h4 id="getH1"> <?php echo JHTML::link($product->link, $product->product_name); ?><h/4>

Link to comment
https://forums.phpfreaks.com/topic/255448-php-echo-in-a-popup/#findComment-1313115
Share on other sites

Deamon1767 just to let you know if you would look at UrbanDweller second post on here you would have noticed he added alittle code in his quotes.. so if you would copy and paste this it should work like you want it to..

 

 

<script type="text/javascript">
window.onload = function(){
var text = document.getElementById("getH1").innerHTML;
alert(text);
}
</script>

   <h4 id="getH1"> <?php echo JHTML::link($product->link, $product->product_name); ?></h4>

Link to comment
https://forums.phpfreaks.com/topic/255448-php-echo-in-a-popup/#findComment-1313149
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.