...

View Full Version : could anyone help me with a basic assignment?



Indigo1
12-14-2009, 08:07 PM
http://i50.tinypic.com/2njcxn5.png

basically.. a button that changes the color of that box.. the font to bold.. and changes a frame from two search engine websites.

jmrker
12-14-2009, 08:45 PM
Would be nice to see your attempts at the solutions rather than an image of the problems.

tonynoname123
12-14-2009, 08:49 PM
not allowed to post assignments...

Indigo1
12-14-2009, 08:49 PM
got close here:

<html>
<head>
</head>

<body>

<img id="imgSearch" src="" alt="Websites" />
<input type="button" value="Toggle Search" id="btnSearch" onclick = "toggle()"/>
<br><br>

Traffic Light: <span id="trafficLight">Traffic light stuff</span>
<input type="button" value="Prevent Accident" id="btnTraffic" onclick = "changeColor()" />

<br><br>
<p id = "Stuff">I want this bold when you hit the button!
<input type="button" value="Set Bold" id="btnBold" onclick = "setBold()"/> </p>

<script type = "text/javascript">
var Sx = 0;
function toggle(){
if (Sx%2 == 0) {
Sx ++;
window.location = "websiteA.com";
}
else {
Sx ++;
window.location = "websiteB.com";
}
}

var Tx = 0;
function changeColor() {
if (Tx%3 == 0) {
document.getElementById("trafficLight").style.color="red";
}
if (Tx%3 == 1) {
document.getElementById("trafficLight").style.color="yellow";
}
if (Tx%3 == 2) {
document.getElementById("trafficLight").style.color="green";
}
Tx ++;
}

function setBold() {
document.getElementById("Stuff").style.fontWeight= "bold";
}

</script>

</body>
</html>

Old Pedant
12-15-2009, 04:01 AM
So what's missing???

Old Pedant
12-15-2009, 04:03 AM
Oh, I see.

You need an <iframe> to hold the search site URL.

And then you need to change the ".src" property of the iframe, *NOT* the window.location.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum