Besttoolbars Development network

Back to Besttoolbars main site

 

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Button React to Javascript Variable on Page?

 
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> General questions
Author Message
casbboy



Joined: 22 Mar 2007
Posts: 3

PostPosted: Mon Mar 26, 2007 3:43 am    Post subject: Button React to Javascript Variable on Page? Reply with quote

I thought about adding a javascript function that creates a variable on some of my website's pages.

Is it possible for the toolbar to read javascript variables within a page the user is viewing?

I want to take the variable and convert it into a link that works when a button is clicked.

Thanks
Ryan
Back to top
Admin
Site Admin


Joined: 22 Aug 2006
Posts: 1055

PostPosted: Tue Mar 27, 2007 7:09 am    Post subject: Reply with quote

You may create variables as follows :

rtn = tool.Variable('#' + name + '#');

tool.Variable('#' + name + '#') = "value";

Please, refer to 'Toolbar JavaScript Interface' section of our Advanced Guide.
Back to top
casbboy



Joined: 22 Mar 2007
Posts: 3

PostPosted: Tue Mar 27, 2007 9:02 pm    Post subject: Reply with quote

Been trying all day, can't get it to work:

here is what I have as my button in the toolbar:

Code:

<BUTTON id="tbs_button_009776" caption="Save Page (Java)" type="Split" visibility="1" command="redirect" href="javascript:if(typeof arturl=='undefined') {location.href='http://www.mysite.com/savefav.php?url=%url'} else {location.href='http://www.mysite.com/savefav.php?url='+ arturl +''}"/>


Here is what I have on my HTML page being accessed:

Code:

<script type="text/javascript" language="javascript">
var MyTool = null;
function ToolBarInit (tool)
{
MyTool = tool;

rtn = tool.Variable('#' + arturl + '#');

tool.Variable('#' + arturl + '#') = "http%3A%2F%2Fwww.google.com%";
}

</script>


I used google for sake of example.

what I am trying to do. When a person views a page on heffee, I want it to use a URL provided through the script above. Each page on my site will have a URL different from the actual page.

When the toolbar does not get the variable (as it would from my site), it just does a standard redirect with the url of whatever page the user is on.

I want the 'arturl' variable created on the webpage to be passed up into the toolbar on page load.

What am I missing?
Back to top
casbboy



Joined: 22 Mar 2007
Posts: 3

PostPosted: Wed Mar 28, 2007 4:30 am    Post subject: Reply with quote

Read the manuals and other posts. Fail to point out what scripting goes on the webpage itself and what goes into the toolbar's working folder.

Ryan
still stuck
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BestToolbars.Net Forum Index -> General questions All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group

Copyright c Softomate, 2010. All Rights Reserved
Terms of Service | Privacy Policy