如何从aspx页面本身调用内容页面中的javascript函数 [英] how to call a javascript function in content page from aspx page itself

查看:69
本文介绍了如何从aspx页面本身调用内容页面中的javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在aspx页面中调用javascript函数,即源代码本身在加载时

我的代码示例是:

I am calling a javascript function in the aspx page i.e source code itself onload

My code sample is:

<asp:Content ID="head" ContentPlaceHolderID="headcontent" Runat="Server">
function func1()
{
alert('the code i want to bind to dropdownlist ');
}
window.onload=func1
function func2()
{
alert('hai');
}


但它不起作用


but it was not working

Is there any way of using window.onload in content pages?

推荐答案



试试以下

Hi,

Try the following

function test() {
           alert('Page Loaded');
       }
       window.onload = function () { test() };



window.onload = function(){


or
window.onload = function () {

alert('Page Loaded');


};


希望这会有所帮助.


};


Hope this helps.


这篇关于如何从aspx页面本身调用内容页面中的javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆