How Can I Write Javascript For Server Controls?
Oct 13, 2005I am a .Net Developer. I want to know to write javascript for serverside controles.And where it is placed for sever sidr controls. Please tell me if any one know this.
View 1 RepliesI am a .Net Developer. I want to know to write javascript for serverside controles.And where it is placed for sever sidr controls. Please tell me if any one know this.
View 1 RepliesI am trying to write a class or function (not sure which is needed) that controls stats on my page. I currently have a working example but I need additional functionality and I'm not sure how to do it. Basically it needs to run every 6 seconds to update the stats(as they change constantly).
I need the javascript to connect(using ajax) to a database and retrieve stats to initially store as global variables. Then, as stated, I need it to modify(simple math that I can do) these stats every 6 seconds.
I have a web form that has a checkbox on it and a textbox associated
with it. I want the textbox to be displayed when the checkbox is checked
and I want this to happen on the client-side instead of posting back to
the server. The checkbox is a server control (asp:checkbox...). I can
write some codebehind that will display an alert message upon checking
the box that looks something like this...
Page_Load...
Dim s As String
Dim scriptString As New System.Text.StringBuilder
chkExpDate.Attributes.Add("onclick", "alertmsg()")
scriptString.Append("<script language=JavaScript> function alertmsg()
{")
scriptString.Append("alert('hi'); }<")
scriptstring.Append("/" + "script>"
s = scriptstring.ToString()
Page.RegisterStartupScript("startup", s)
End Sub
I used this as a test to make sure the server control was running the
script. But, when I change the script to assess the value of the server
control checkbox such as checked = true, I get errors and if I just try
to display the asp:textbox, it doesn't work either.
I have now learned how to write to and read from .txt files on my server via php, but is it possible to do this with JavaScript? Like that JavaScript writes to the .txt file every second without needing the user to refresh the page to write or read .txt file (with php). 2: Do the same thing with ActionScript 2/3.
View 9 Replies View RelatedDoes anyone know of a way I can check asp validator controls from the client
side? I need to be able to opt out of a postback if any validators are
false. I am using a ComponentArt tabstrip and it proceeds with posting back
even if "IsValid" is false.
I am trying to write a string variable containing XML in the form of text into an iframe such that it shows up as formatted XML with the expand(+) and collapse (-) options that default in IE when opening an XML file.
The first thing I tried is writing the string to a file with .xml extension and setting the iFrame src to that file. This works well normally, however in this case, the file does not get created where I want to due to some security restrictions in IE which I cannot edit as I dont have admin rights.
Secondly I tried appending the string as innerHTML to that iframe but only the content within the XML tags without any formatting shows up which is not intended.
Thirdly I cannot use any server side scripting as this is a very controlled environment and I am not allowed to host servers or edit server scripts at will. This is totally out of question, so I guess Ajax or calling a costom defined web service wont help.
At best I can say, I am limited to HTML, Javascript and vbScript.
I am receiving the string as a responseText from an ajax request which is consuming a web service. If I use responseXML, it doesn't work.
The solution I am looking at is to either display it as formatted XML in an iFrame or to just throw it into a textarea which I am already doing and simultaneously write it to an XML file or do both. If not automatically, atleast have the user press a button and do it.
I want to stream audio into a hidden frame and load, stop, and control
volume via JavaScript. I'm thinking w/ Windows Media Player.
This forum thread discusses the SitePoint article 'Re-Write a Layer's Content with Javascript' by Peter Todorov.
"How can you can replace the content of a Web page without additional requests to the server? The answer uses layers in JavaScript - Peter explains all."
How do you write javascript function value to <input type='hidden' name='example' value='function()'>
View 7 Replies View RelatedBasically, I have a button which when clicked, should write some html to the page at a specific location. Here's the html currently in the page Code:
View 8 Replies View RelatedIs it possible to get the web - server name through Javascript? If yes, how?
My code goes as follows. I get an error after executing this
<html>
<head>
<title>Untitled</title>
<script>
function disp()
{
str1 = location.host();
alert(str1);
}
</script>
</head>
<body>
<cfoutput>
<a href="##" onclick="disp();">Click me</a>
</cfoutput>
<cfabort>
</body>
</html>
I am using a standard javascript that I downloaded from
javascriptsource.com to read from and fill in a form using cookies.
The page tests well in every browser except Apple's Safari (from
10.3.2)
Unfortunately, my clients daughter uses Safari so I have to get it to
work with it, even though most of his clients use IE.
What do I need to do to change the code so this will all work in
Safari? Code:
I'm back after giving up two years ago to write a page of html code with javascript in it.
I want to display a table with five images (tumbnails) per row with the name of the image (my code number for the image) under it. I want 4 rows of images for a total of 20 images (tumbnails).
I want when someone clicks on one of the tumbnail images a new window opens with the fullsize image displayed.
I have written an html page that does this but I have over 50 such pages that I need to create for my website. Here is the code that does this for each table image cell. Code:
However, this piece of Javascript uses some other script which is large.
<script src = "./js/tmp.js".....>
This will work if the file "tmp.js" is local. However this reduces the
portability of my *utility* Javascript
as users have to have that "tmp.js" for every webpage they have (if they
want to use it :D)
I thought of uploading "tmp.js" it to somewhere and change my code to
<script src = http://www.somewhere.com/js/tmp.js ....>
The all the users have to do is copy the piece of code that I wrote
BUT THIS DOES NOT WORK. I TRIED IT.
My questions are:
1. Is there something wrong with server-side Javascript? Or am I missing
something?
2. Is there another way to make my code portable?
I'd like to implement a server socket in java: something linke the following example.
The problem is that the HTML has not the permission to execute instruction
serverSocket = Components.classes["@mozilla.org/network/server-socket;1"].
createInstance(Components.interfaces.nsIServerSock et);
Question:
1 - how do I give it this permisison?
2 - one solution I thought was to put the javascript code in a firefox
extension, to load, so it should have all needed permisison, but,
How can I call a java script function define in an extension
from an html page? - there's some particular syntax? ....
I have three different web pages with different domains, and I want to
show some pages of one of the webs in the others.
I use an iframe for this and it shows it good until I have to call a
javascript function in the iframe inside page, I have a permission
denied because the domains of these pages are different.
So, the cuestion is:
Is there some way to call the javascript function of the iframe from
the parent page?
The script below loads a calendar page in an iframe and scrolls to
today's date.
It works just dandy on my apache/linux server, but won't do anything
when I use IIS. (Nothing appears on the page at all where the script is
at.)
I'd appreciate any suggestions on how to make this work from the IIS
server. Code:
I might be turning a corner today and seeing the light. I might still
be confused :)
If JavaScript is the language for the browser then why do servers use
Ruby/Rails, Perl/Catalyst, Python/Turbogears or PHP/Cake? Is it because
the prototype-based language is too different to be chosen except when
necessary. Is it because browser bugs make people think JavaScript is
bad? Is JavaScript not suitable for the server-side for any reason?
I imagine that if server-side programmers started to learn JavaScript
then the client-side code in the world might start to improve.
Translation layer libraries like Prototype.js or Mochikit wouldn't need
to exist. The more I learn about JavaScript the more I like it. It is
difficult to learn however for multiple reasons.
I have seen web pages sites, when you drop down a list box, it seems to go
back to the server to retrieve some data without reloading the whole page
(e.g. select make of car and it retrieves a list of models from the server
to populate another list box).
I was handed a project that, when launched, had some ajax problems--specifically, "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open." That's easy enough to fix--found the call in the .js file that was referencing the development server instead of the live server, and I am aware of Javascript's same-origin policy, which makes good clean sense. Change that call, problem solved.
Unfortunately, it's not solved. I can change the reference from
var url='http://www.devserver.com/function.php?id='+id;
to
var url='http://www.liveserver.org/function.php?id='+id;
but that doesn't solve the issue of if someone comes to the page without the 'www' or to the other domain, whose TLD is a .com instead of .org.
In PHP, I'd simply write the function to dynamically generate the url string, using $_SERVER variables rather than hardcoding the url. But I'm no javascript guy. Any help would be appreciated.
I'd rather not have to put a php redirect in every page to make sure the url is what I want it to be. I'd much rather learn something new about Javascript.
IE 6.0 (not interested in other browsers at the moment)
I have looked everywhere I can find to look and googled until I am
cross-eyed and am hoping somebody knows what I'm doing wrong.
I have an HTML application (.hta) working fine, except one thing. I'm
trying to write to a local database from a .htm window (opened from
the main .hta window) and it doesn't work with any of the combinations
I've tried (and I admit to having tried a lot).
Here is one method I've tried:
strSQL = "Update myTable SET myField = 'myValue' WHERE myID = 12;"
var db = new ActiveXObject("ADODB.Connection");
db.Provider = "Microsoft.Jet.OLEDB.4.0";0
db.ConnectionString = "Data Source='c:myDirectorymyDatabase.mdb'";
db.Open;
db.execute(strSQL);
I can easily access the information in the myDatabase.mdb and display
it on the screen.
I can ask for updated information to be input on the screen.
But stuffing that updated information back into the database is the
problem.
Since I'm stuck in an .htm window, I don't have VBScript available, do
I? If VBScript isn't available and it isn't physically possible with
Javascript, then I'll have to revert to .hta windows, where I know I
have VBScript available. But I'd rather do it all in Javascript
within the .htm so as to avoid the security message that pops up when
the .hta opens a new .hta. For various reasons I don't think it is
possible for me to do this whole project within a single .hta.
I have a number of server-side Javascript applications running on an
old Netscape Enterprise server. I want to move them to Apache. Is
there a way to do this without extensive recoding ? My code contains
a lot of Oracle and SQL Server database interaction.
Is it possible to get the Server IP Address from Javascript
ie., when the user types "http://10.0.0.10/main.htm" in the web
browser, i need to retrive the value of the IP Address(10.0.0.10) from
my client side javascript.
I want to populate my client's webpage (Remote Server) automatically
through my Server and Database by having him just paste a javascript
on his webpage.
I have read up about Microsoft Remote Scripting but the documentation
states the following : "The server which you make remote scripting
calls must be the same server from which you requested the client page
containing the requests."
In my case , the client and server pages are on two seperate servers
which means that I cannot use MS Remote Scripting.Is there an alternate
approach in any scripting language ???
Any suggestions, tutorials , websites , code snippets will be
appreciated while i continue to research on this...
Ref. http://support.microsoft.com/kb/834489/en-us
Now that http://username:password@site.com no longer is an accepted
syntax in IE, I suddenly have a case in a project I'm working on. The easiest(?)
solution would now be that there was some Javascript function that
could pass the username and password or in som other way automate the login
process on a given site.
Thing is I have a server-generated HTML page that I want to make the
client redirect to a password protected site. (IIS Windows authentication).
Before: location.href='http://name:pwd@site.com'
Now: ?
I'd like to adapt some Greasemonkey scripts that I've written and have
them applied to html files on the server side before the files are sent
to users. I'm only looking at adapting scripts that make static
changes to pages. For instance, consider a script that removes from
the DOM any img that has "ad" in its src.
I'm sure there are better ways to do this and I'm not even necessarily
looking for an extremely efficient solution. Mostly, I just want to
know if there's an existing product that could do this or with
reasonable effort could be made to do this.