Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Design

Simple Javascript VAR Question

Author Message
ifthensoftware



Joined: 09 Jan 2007
Posts: 3

Posted: Thu Jan 11, 2007 - 11:07 am    Post subject: Simple Javascript VAR Question Reply with quote

New to Javascript and here's my problem:

I simply want a graphic to change from one to another if a particular varible is true or not. I have this currently:

function show()
{

var output = widget.system("/usr/bin/osascript checkTest.scpt", null);
document.getElementById('status').innerText = output.outputString;
{
if(output=="Passed")

document.getElementById('mainImage').src = 'Images/passed.png';

}


}

This is supposed to change the graphic if the output is equal to "passed," which isn't working. Any ideas? In human speak I want to say "Please change this graphic from this to something else if this variable is equal to the word "Passed"

Thanks!
View user's profile Send private message Send e-mail Visit poster's website Widgets
jimmac



Joined: 05 Sep 2005
Posts: 23

Posted: Thu Jan 11, 2007 - 9:35 pm    Post subject: Reply with quote

Quote:
function show()
{

var output = widget.system("/usr/bin/osascript checkTest.scpt", null);
document.getElementById('status').innerText = output.outputString;
{
if(output=="Passed")

document.getElementById('mainImage').src = 'Images/passed.png';

}


}


If this is exactly what your code is, one problem is that you have a "curly brace" misplaced.

The second "{" symbol should appear after the "if" opening line.

Thus, you code should be:

Code:

function show()
{

var output = widget.system("/usr/bin/osascript checkTest.scpt", null);
document.getElementById('status').innerText = output.outputString;

if(output=="Passed")
{
document.getElementById('mainImage').src = 'Images/passed.png';

}


}


I don't know if anythng else is wrong, but that curly brace was misplaced.

Hope this helps! Let us know!

Jim
View user's profile Send private message Send e-mail Visit poster's website Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group