PDA

View Full Version : Including PHP in a page w/Javascript


MaverickMT
01-24-2003, 05:37 AM
Hi, I have a sort of simple question. I hope you guys can help me.

I'll start out with my html (this is bottomright.htm, for reference:

<html>
<head>
<script>
var originalhtml;
var cardinfopref = true;
function InitScript() {
originalhtml = content.innerHTML;
}
function DisplayCard(cardname) {
content.innerHTML = ????
}
function ResetFrame(){
content.innerHTML = originalhtml;
}
function TurnItOn(){
cardinfopref = true;
}
function TurnItOff(){
cardinfopref = false;
}
</script>
</head>
<body onload="InitScript()">
<div id="content">hello? please replace me</div>
<font onmouseover="DisplayCard('calloftheherd')">heeeeere</font>
</body>
</html>


here's what I want the code to do..I want it to replace the "content" id with the output from a php that I made. The php is http://www.magictutorial.com/scripts/cardinfo.php. You need to call it w/the parameter of a Magic: The Gathering card's name, such as "http://www.magictutorial.com/scripts/cardinfo.php?card=phyrexiannegator" for example.

That about sums it up - can it be done?



Here's the extended application for anyone who wants to offer an alternate solution or if what I want can't be done simply.

On the site MagicTutorial.com, this frame serves as a "card info" frame. When someone moves their mouse over a card's name in the main content frame of MagicTutorial (that scripting's taken care of), I want it to call parent.frames.BottomRight.DisplayCard(phyrexiannegator). The bottomright.htm will already have some code/text in it, and the first thing I do is save the contents of that div so I can revert to it on an onmouseout. I don't want to just open a link to that php because then it will mess with the browser's Back history; I'd really like it if that bottomright.htm loaded only once.


Well, now that, finally, should be about it. Can anyone here help me? I'd really appreciate it; thanks in advance